function SendGift(){
	this.timer_time = 1*1000;
	this.timer_count_down = 1800;
	this.gift_id = null;//礼物id
	this.click_count = 1;//连击次数
	
	this.setInterval_ojb = null;
}

SendGift.prototype={
	init:function(){
	},
	send_gift:function(_this){
		if($("#liveLwList").children().length == 2){
			var removeId = parseInt(_this.gift_id)-2;
			$("#lw"+removeId).remove();
		}
		$("#liveLwList").eq(0).append(_this.appendHTML());
		$("#lw"+_this.gift_id).animate({"margin-left":"0"},"fast");
		_this.timer();
	},
	lianji:function(){
		var _this = this;
		_this.click_count++;//连击
		$("#lw"+_this.gift_id).find(".liveSendCount,.liveSendCh").addClass('liveLwScale');
		setTimeout(function ()
		{   
			$("#lw"+_this.gift_id).find(".liveSendCount,.liveSendCh").removeClass('liveLwScale');
		}, 110);
		$("#lw"+_this.gift_id).find('.liveSendCount').html(_this.click_count);
		_this.timer_count_down = 1800;
	},
	appendHTML:function(){
		var _this = this;
		var html = '';
		html = '<div class="liveSendWrap" id="lw'+ _this.gift_id +'">'+
							'<div class="liveSendLw boxBbt">'+
								'<span class="liveHeader"><img src="misc/img/test5.jpg" /></span>'+
								'<h3 class="liveSendName"><em>雍容风雅</em><p>送出<i>'+$(".lwSend span").attr("data-name")+'</i><i>'+$(".lwCurrCount").val()+'个</i></p></h3>'+
								'<span class="iconLw"><img src="'+ $(".lwSend span img").attr("src") +'"></span>'+
								'<span class="liveSendCh"></span>'+
								'<span class="liveSendCount liveLwScale">'+ _this.click_count +'</span>'+
							'</div>'+
						'</div>';
		return html;				
	},
	timer:function(){
		var _this = this;
		var set = setInterval(function(){
			if(_this.timer_count_down < 1){
				$("#lw"+_this.gift_id).stop().animate({"margin-left":"-380px"},"fast",function(){
					$("#lw"+_this.gift_id).remove();
				});
				clearInterval(set);	
				return;
			}
			_this.timer_count_down--;
			console.log(_this.gift_id, _this.timer_count_down);
		}, _this.timer_time);
	}
}
